package com.ali.aliwebsite.controller;

import com.ali.aliwebsite.entity.Video;
import com.ali.aliwebsite.mapper.VideoMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class VideoController {
    @Autowired
    VideoMapper videoMapper;

    //加载视频列表

    @RequestMapping("/video/list")
    public List<Video> selectAll() {
        List<Video> videoList = videoMapper.selectAll();
        return videoList;
    }

    @RequestMapping("admin/video/list")
    public List<Video> selectAdminAll() {
        List<Video> videoList = videoMapper.selectAll();
        return videoList;
    }

    //更新视频url
    @RequestMapping("admin/video/update")
    public String updateVideo(@RequestParam String url, @RequestParam int id) {
        videoMapper.update(url, id);
        return "success";
    }


}
